{ 
  //泛型约束，相当于继承接口的属性和类型定义
  interface myLength{
    length:number
  }
  function getId<type extends myLength>(id:type){
    console.log(id.length)
    return id
  }
  let result=getId("123")
  console.log(result)
  //错误，因为不满足接口定义的属性
  // let result2=getId(123)
  // console.log(result2)
}